<script type="text/javascript" src="/public/library/jquery/jquery.form.js"></script>
<script src="/public/library/hvn/event.search.js" type="text/javascript"></script>
<script src="/public/library/hvn/event.js" type="text/javascript"></script>
<script src="/public/library/hvn/place.js" type="text/javascript"></script>

<link type="text/css" href="/public/library/jquery/calendar/excite-bike/ui.all.css" rel="stylesheet" media="screen" />
<link rel="stylesheet" href="/public/library/jquery/calendar/excite-bike/jquery-ui-1.7.1.custom.css" type="text/css" media="screen" />

<script type="text/javascript" src="/public/library/jquery/calendar/amlich.js"></script>
<script type="text/javascript" src="/public/library/jquery/calendar/ui.core.js"></script>
<script type="text/javascript" src="/public/library/jquery/calendar/ui.datepicker.js"></script>
<script type="text/javascript" src="/public/library/jquery/calendar/ui.datepicker-lang.js"></script>
<script type="text/javascript">
	
	$(function(){
	    <?if(isset($this->viewParams['cityId'])) :?>
			$("div.city_address").css('display', 'none');
		<?endif?>
	
		<?if(isset($this->viewParams['category'])) :?>
			$("div.category").css('display', 'none');
		<?endif?>
		
		//city
		$("div#sukien_more_city").find("a").click(function(){
			$("div#sukien_box_right_city_hide").css('display', 'block');
			$("div#sukien_box_right_city_show").css('display', 'none');
			$("div#sukien_more_city").css('display', 'none');
		});
		
		$("div#sukien_less_city").find("a").click(function(){
			$("div#sukien_box_right_city_hide").css('display', 'none');
			$("div#sukien_box_right_city_show").css('display', 'block');
			$("div#sukien_more_city").css('display', 'block');
		});
		
		<?if(!isset($this->viewParams['listDistrict'])) :?>
			$("div#sukien_box_right_district_not_featured").css('display', 'block');
		<?endif?>
		//disitrict
		$("div#sukien_more_district").find("a").click(function(){
			$("div#sukien_box_right_district_not_featured").css('display', 'block');
			$("div#sukien_box_right_district_featured").css('display', 'none');
			$("div#sukien_more_district").css('display', 'none');
		});
		
		$("div#sukien_less_district").find("a").click(function(){
			$("div#sukien_box_right_district_not_featured").css('display', 'none');
			$("div#sukien_box_right_district_featured").css('display', 'block');
			$("div#sukien_more_district").css('display', 'block');
		});
		
		//rtype
		$("div#sukien_more_rtype").find("a").click(function(){
			$("div#sukien_box_right_rtype_hide").css('display', 'block');
			$("div#sukien_box_right_rtype").css('display', 'none');
			$("div#sukien_more_rtype").css('display', 'none');
		});
		
		$("div#sukien_less_rtype").find("a").click(function(){
			$("div#sukien_box_right_rtype_hide").css('display', 'none');
			$("div#sukien_box_right_rtype").css('display', 'block');
			$("div#sukien_more_rtype").css('display', 'block');
		});
		
		//type
		$("div#sukien_more_type").find("a").click(function(){
			$("div#sukien_box_right_type").css('display', 'none');
			$("div#sukien_box_right_type_hide").css('display', 'block');
			$("div#sukien_more_type").css('display', 'none');
		});
		
		$("div#sukien_less_type").find("a").click(function(){
			$("div#sukien_box_right_type_hide").css('display', 'none');
			$("div#sukien_box_right_type").css('display', 'block');
			$("div#sukien_more_type").css('display', 'block');
		});
		
		$('.chooseOtherCity').openDOMWindow({ 
	                        height:400, 
	                        width:510, 
	                        positionType:'centered', 
	                        positionTop:100, 
	                        eventType:'click', 
	                        positionLeft:100, 
	                        windowSourceID:'#chooseCity', 
	                        windowPadding:5, 
	                        /*draggable:1,*/ 
	                        windowBGColor:'#FFFFFF', 
	                        borderColor:'#24386c',
	                        borderSize: '12', 
	                        overlayOpacity:40 
	                });
	                
	     $('.chooseOtherCategory').openDOMWindow({ 
	                        height:250, 
	                        width:510, 
	                        positionType:'centered', 
	                        positionTop:100, 
	                        eventType:'click', 
	                        positionLeft:100, 
	                        windowSourceID:'#chooseCategory', 
	                        windowPadding:5, 
	                        /*draggable:1,*/ 
	                        windowBGColor:'#FFFFFF', 
	                        borderColor:'#24386c',
	                        borderSize: '12', 
	                        overlayOpacity:40 
	                });
	                
	     $("#list_districtId input:checkbox[name=district_id[]]").click(function(){
	     	val = $(this).val();
	     	if($(this).is(":checked"))
	     	{
	     		
	     	}
	     	else
	     	{
	     		dis = $('.new_districtId').val();
	     		ids = dis + ',' + $(this).val();
	     		$(".new_districtId").attr("value", ids);
	     	}
	     });
	     
	     $("#list_type input:checkbox[name=type[]]").click(function(){
	     	if($(this).is(":checked"))
	     	{
	     	}
	     	else
	     	{
	     		dis = $('.new_Type').val();
	     		ids = dis + ',' + $(this).val();
	     		$(".new_Type").attr("value", ids);
	     	}
	     });
	     
	     // make less box and more box synchronized between clicks
	     $("#sukien_box_right_district_featured input:checkbox").click(function(){
	    	id = $(this).attr("value");
	    	checked= $(this).attr("checked");
		    $("#sukien_box_right_district_not_featured input:checkbox[value=" + id + "]").attr("checked", checked);
		});
	
	     $("#sukien_box_right_district_not_featured input:checkbox").click(function(){
	    	id = $(this).attr("value");
	    	checked= $(this).attr("checked");
		    $("#sukien_box_right_district_featured input:checkbox[value=" + id + "]").attr("checked", checked);
		});
	});

	function submit()
	{
		document.frmsearch.submit();
	}
</script>
<? $sess = new Zend_Session_Namespace(CLU_NS);?>
<div class="box white_bg">

<form id = "form_id" name="frmsearch" accept-charset="UTF-8" action="<?= $this->escape($this->viewParams['form']->getAction()) ?>"
      method="<?= $this->escape($this->viewParams['form']->getMethod()) ?>">

<div class="region4_into">
         <div class="box">
           <div class="chitiet_bar">
             <div class="chitiet_bar_left"></div>
             <div class="chitiet_bar_right"><?=t(219)?></div>
           </div>
           <div class="chitiet_content">
           	   <div class="city_address">
               <div class="sukien_box_left"><span>*</span> <?=t(770)?> &nbsp;&nbsp;</div>
               <div class="sukien_box_right" id="sukien_box_right_city_show">
               		<?$i = 0;?>
                 	<?foreach ($this->viewParams['listCity'] as $top) :?>
                     <div class="sukien_box_right_item">
							<?if($top['status'] == 'featured') :?>
									<a href="<?=$this->hvnUrl(array('module'=>'event','action' => 'search'), 'nocontroller')
											?>?cluSearch=1&city_id=<?=$top['city_id']?>
											<?if(isset($this->viewParams['categoryId'])) :?>&category=<?=$this->viewParams['categoryId']?><?endif?>
											<?if(isset($this->viewParams['category'])) :?>&category=<?=$this->viewParams['category']?><?endif?>
											"><?if($sess->viewLang == 'vi')echo $top['city_name']; else echo VN_unaccent($top['city_name'])?></a>
							<?endif?>
                     </div>
                     <?$i++?><?if($i == 6) :?><?break?><?endif?>
					<?endforeach?>
               </div>  
	              <div class="sukien_more" id="sukien_more_city"><a href="javascript:void();"><?=t(150)?></a></div>  
	              <div class="sukien_box_right" id="sukien_box_right_city_hide" style="display:none;">
		              <?for ($i = 0; $i < count($this->viewParams['listCity']); $i++) :?>
		                   <div class="sukien_box_right_item">
						   		 <?$top = $this->viewParams['listCity'][$i]?>
									<div class="switch_top_city">
										<a href="<?=$this->hvnUrl(array('module'=>'event','action' => 'search'), 'nocontroller')
												?>?cluSearch=1&city_id=<?=$top['city_id']?>
												<?if(isset($this->viewParams['categoryId'])) :?>&category=<?=$this->viewParams['categoryId']?><?endif?>
												<?if(isset($this->viewParams['category'])) :?>&category=<?=$this->viewParams['category']?><?endif?>
												"><?if($sess->viewLang == 'vi')echo $top['city_name']; else echo VN_unaccent($top['city_name'])?></a>
									</div>
		                   </div>
		              <?endfor?>
	                 <div class="sukien_less" id="sukien_less_city"><a href="javascript:void();"><?=t(197)?></a></div> 
	             </div>   
         	</div>
         <?if(isset($this->viewParams['listDistrict'])) :?>
           <div class="sukien_box_left"> <span>*</span> <?=t(771)?> &nbsp;&nbsp;</div>
           <div class="sukien_box_right_left"><span><?if($sess->viewLang == 'vi')echo $this->viewParams['cityName']; else echo VN_unaccent($this->viewParams['cityName'])?></span></div>
           <div class="sukien_box_right_right">
           		<a href="#chooseCity" class="chooseOtherCity" ><?=t(907)?></a>
                <div id="chooseCity" style="display: none;">
                
                 <div class="clear"></div>
                 <div class="chitiet_bar_ajax" style="width: 100%">&nbsp;&nbsp;<?=t(907)?></div>
          <br /><br /><br />
                	<?for ($i = 0; $i < count($this->viewParams['listCity']); $i++) :?>
		               <div class="sukien_box_right_item">
					   		 <?$top = $this->viewParams['listCity'][$i]?>
								<a href="<?=$this->hvnUrl(array('module'=>'event','action' => 'search'), 'nocontroller')
									?>?cluSearch=1&city_id=<?=$top['city_id']?>
									<?if(isset($this->viewParams['categoryId'])) :?>&category=<?=$this->viewParams['categoryId']?><?endif?>
									<?if(isset($this->viewParams['category'])) :?>&category=<?=$this->viewParams['category']?><?endif?>
									"><?if($sess->viewLang == 'vi')echo $top['city_name']; else echo VN_unaccent($top['city_name'])?></a>
		             	  </div>
		          	<?endfor?>
                </div> 
           </div>
           <?endif?>
     		<?if(isset($this->viewParams['listDistrict'])) :?>
	           <div class="sukien_box_right" id="sukien_box_right_district_featured">
	           <?$i = 0;?>
	         	<?foreach ($this->viewParams['listDistrict'] as $dis) :?>
	                 	<div class="sukien_box_right_item" id="list_districtId">
								<input type="checkbox" name="district_id[]" value="<?=$dis['district_id']?>">
									<?if($sess->viewLang == 'vi')echo $dis['district_name']; else echo VN_unaccent($dis['district_name'])?>
								</input>
	                 	</div>
	               <?$i++;?>
	               <?if($i == 6) :?><?break;?><?endif?>
				<?endforeach?>
	           </div>
	         <?if(count($this->viewParams['listDistrict']) > 6 ) :?>
	        	<div class="sukien_more" id="sukien_more_district" style="display:block;"><a href="javascript:void();"><?=t(150)?></a></div>
	        <?endif?>  
			<?endif?>
			<?if(isset($this->viewParams['listDistrict'])) :?>		
            <div class="sukien_box_right" id="sukien_box_right_district_not_featured" style="display:none;">
	         	<?for ($i = 0; $i < count($this->viewParams['listDistrict']); $i++) :?>
					<?$dis = $this->viewParams['listDistrict'][$i];?>
	                 	<div class="sukien_box_right_item" id="list_districtId">
							<input type="checkbox" name="district_id[]" value="<?=$dis['district_id']?>">
								<?if($sess->viewLang == 'vi')echo $dis['district_name']; else echo VN_unaccent($dis['district_name'])?>
							</input>
	                 	</div>
				<?endfor?>
				<div class="sukien_less" id="sukien_less_district"><a href="javascript:void();"><?=t(197)?></a></div>
	           </div>
			<?endif?>
            
            <div class="clear"></div> 
	           <!-- category-->
	           <div class="box box_margin">
           	   <div class="category">
               <div class="sukien_box_left">
                     <span>*</span> <?=t(779)?> &nbsp;&nbsp;
               </div>
               <div class="sukien_box_right" id="sukien_box_right_rtype">
                 	<?foreach ($this->viewParams['listCategory'] as $k => $category) :?>
                     <div class="sukien_box_right_item">
								<a href="<?=$this->hvnUrl(array('module'=>'event','action' => 'search'), 'nocontroller')
										?>?cluSearch=1<?if(isset($this->viewParams['cityId'])) :?>&city_id=<?=$this->viewParams['cityId']?><?endif?>
										<?if(isset($this->viewParams['dist_Id'])) :?>&district_id=<?=$this->viewParams['dist_Id']?><?endif?>
										&category=<?=$category['id']?>
										"><?=p($category['name'])?></a>
                     </div>
					<?endforeach?>
               </div>  
               <?if(count($this->viewParams['listCategory']) > 8 ):?>  
              	<div class="sukien_more" id="sukien_more_rtype"><a href="javascript:void();"><?=t(150)?></a></div>
              <?endif?>  
              <div class="sukien_box_right" id="sukien_box_right_rtype_hide" style="display:none;">
	              <?foreach ($this->viewParams['listCategory'] as $category) :?>
                     <div class="sukien_box_right_item_category">
								<a href="<?=$this->hvnUrl(array('module'=>'event','action' => 'search'), 'nocontroller')
										?>?cluSearch=1<?if(isset($this->viewParams['cityId'])) :?>&city_id=<?=$this->viewParams['cityId']?><?endif?>&category=<?=$category['id']?>"><?=p($category['name'])?></a>
                     </div>
					<?endforeach?>
                 <div class="sukien_less" id="sukien_less_rtype"><a href="javascript:void();"><?=t(197)?></a></div> 
             </div> 
         	</div>
     	<?if(isset($this->viewParams['category'])) :?>
           <div class="sukien_box_left">
                 <span>*</span> <?=t(816)?> &nbsp;&nbsp;
           </div>
           <div class="sukien_box_right_left" style="width:500px;"><span><?=p($this->viewParams['categoryName']['name'])?></span></div>
           <div class="sukien_box_right_right">
           		<a href="#chooseCategory" class="chooseOtherCategory" ><?=t(908)?></a>
                <div id="chooseCategory" style="display: none;">
                <div class="clear"></div>
                 <div class="chitiet_bar_ajax" style="width: 100%">&nbsp;&nbsp;<?=t(908)?></div>
          <br /><br /><br />
          
                	<?foreach ($this->viewParams['listCategory'] as $category) :?>
                     <div class="sukien_box_right_item">
								<a href="<?=$this->hvnUrl(array('module'=>'event','action' => 'search'), 'nocontroller')
										?>?cluSearch=1<?if(isset($this->viewParams['cityId'])) :?>&city_id=<?=$this->viewParams['cityId']?><?endif?>
										<?if(isset($this->viewParams['districtId'])) :?>&district_id=<?=$this->viewParams['dist_Id']?><?endif?>
										&category=<?=$category['id']?>
										"><?=p($category['name'])?></a>
                     </div>
					<?endforeach?>
                </div> 
           </div>
           <!--
           <div class="sukien_box_right" id="sukien_box_right_type">
                	<?foreach ($this->viewParams['listType'] as $type) :?>
		               <div class="sukien_box_right_item" id="list_type">
							<input type="checkbox" name="type[]" value="<?=$type['id']?>"><?=p($type['title'])?></input>
	             	  </div>
		          	<?endforeach?>
		    </div>
		    <?if(count($this->viewParams['listType']) > 6 ):?>
	        <div class="sukien_more" id="sukien_more_type"><a href="javascript:void();">Xem tiếp</a></div>
	        <?endif?>
	        <div class="sukien_box_right" id="sukien_box_right_type_hide" style="display:none;">
                	<?foreach ($this->viewParams['listType'] as $type) :?>
		               <div class="sukien_box_right_item" id="list_type">
							<input type="checkbox" name="type[]" value="<?=$type['id']?>"><?=p($type['title'])?></input>
	             	  </div>
		          	<?endforeach?>
		    <div class="sukien_more" id="sukien_less_type"><a href="javascript:void();">Kéo lên</a></div>
		    </div>
		    -->  
			<?endif?>
				<div class="clear"></div> 
	           
	         <div class="sukien_box_left"  style="padding: 0;">
                 <span>*</span>  <?=t(23) ?>&nbsp;&nbsp;
           </div>
            <div class="" align="left"><?=$this->viewParams['form']->frequency?></div>
           <div class="clear"></div>
           
            <div class="sukien_box_left"  style="padding: 0;">
                 <span>*</span>  <?=t(17) ?>&nbsp;&nbsp;
           </div>
            <div class="" align="left"><?=$this->viewParams['form']->fromDay?>  <?=t(18) ?>:<?=$this->viewParams['form']->toDay?></div>
           
           <div class="clear"></div>
           <div id="searchDate">
           <div class="sukien_box_left" style="padding: 0;">
                 <span>*</span>  <?=t(26) ?>&nbsp;&nbsp;
           </div>
            <div class="" align="left"><?=$this->viewParams['form']->startDate; ?> <?=t(18) ?>:<?=$this->viewParams['form']->finishDate; ?> <?=$this->viewParams['form']->calendarType ?></div>
            </div>
              <div class="clear"></div>
					<?if(isset($this->viewParams['form']->status)):?>
					<div class="sukien_box_left"  style="padding: 0;">
                 <span>*</span>	<?=t(2) ?> &nbsp;&nbsp;
           </div>
            <div class="" align="left"><?=$this->viewParams['form']->status?></div>
              <div class="clear"></div>
					<?endif?> 
	           <div class="sukien_box_left"><span>*</span> <?=t(906)?> &nbsp;&nbsp;&nbsp;&nbsp;</div>
	           <!--<div class="sukien_box_right" style="border:0;" >
	               </?=$this->viewParams['form']->title?> &nbsp;&nbsp;<input type="image" src="/public/themes/hard/images/sukien-search.jpg" id="submit" align="absmiddle" />
	           </div>
	           --><div class="sukien_box_right" style="border: 0pt none ;">
			           <div class="sukien_box_right_search_left"><?=$this->viewParams['form']->title?></div> 
			           <div class="sukien_box_right_search_right"><a href="javascript:void();" onclick="submit();" > <?=t(627)?>&nbsp;&nbsp;&nbsp;</a></div>
               </div>
	           <div class="clear"></div> 
	           <input type="hidden" name="city_id" value="<?if(isset($this->viewParams['cityId'])):?><?=$this->viewParams['cityId']?><?endif?>" />
	           <input type="hidden" name="category" value="<?if(isset($this->viewParams['category'])):?><?=$this->viewParams['category']?><?endif?>" />
	           <input type="hidden" class="new_districtId" name="remove_district_id" value="" />
        </div> 
        </div>
        <div class="clear"></div> 
        
           </div>
  </div>    

<!-- 
<?if(isset($this->viewParams['form']->keywords)):?>
<?=t(15) ?> :<?=$this->viewParams['form']->keywords?>
<?endif?>
<?=t(204) ?> :<?=$this->viewParams['form']->events_per_page?>
<br/>

<?=t(21) ?> :<?=$this->viewParams['form']->description?>
<h3> Frequency </h3>
<?=t(23) ?>:
    <?=$this->viewParams['form']->frequency?>
    <span id = "chooseDay" style="display:none">
    <?=t(17) ?>:<?=$this->viewParams['form']->fromDay?>  <?=t(18) ?>:<?=$this->viewParams['form']->toDay?> <br/>
    </span>

<br/>

<div id = "searchDate" >
<?=t(26) ?>:<?=$this->viewParams['form']->startDate; ?> <?=t(18) ?>:<?=$this->viewParams['form']->finishDate; ?> <?=$this->viewParams['form']->calendarType ?>
</div>

<h3> Category </h3>
<?=t(14) ?> :
<input type="checkbox" value="checkall" /><?=t(24) ?> | <input type="checkbox"  value="uncheckall" /><?=t(25) ?>
<br/><?=$this->viewParams['form']->category?>
<br/>
<h3> Admin Search Option </h3>
<?if(isset($this->viewParams['form']->status)):?>
<?=t(2) ?> :<?=$this->viewParams['form']->status?>
<?endif?> 

<input type ="hidden" id = "lang" value = "<?=$this->lang?>" />
<?=$this->viewParams['form']->submit ?> 
-->
</form>   

<script type="text/javascript">
$(function(){
	$("#frequency").trigger("change");
});

	<?if(isset($this->viewParams['districtId'])):?>
			<?foreach ($this->viewParams['districtId'] as $t) :?>
				$("input:checkbox[name=district_id[]]").filter("[value=<?=$t;?>]").trigger("click");
			<?endforeach?>
	<?endif?>
	
	<?if(isset($this->viewParams['type'])):?>
			<?foreach ($this->viewParams['type'] as $t) :?>
				$("input:checkbox[name=type[]]").filter("[value=<?=$t;?>]").trigger("click");
			<?endforeach?>
	<?endif?>
</script>  
</div>